﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;
using MetaTracker.ViewModel;

namespace MetaTracker.View
{
    /// <summary>
    /// Interaction logic for UserSettingsView.xaml
    /// </summary>
    public partial class UserSettingsView : UserControl
    {
        #region Data and Properties
        private bool hasBeenLoaded = false;
        #endregion //Data and Properties

        public UserSettingsView()
        {
            InitializeComponent();
            
            if (DataContext == null || !(DataContext is UserSettingsTabViewModel))
            {
                DataContext = new UserSettingsTabViewModel();
                Debug.WriteLine("Set data context in User Settings");
            }
        }
        ~UserSettingsView()
        {
            Debug.WriteLine("User Settings Destructor called!");
        }

        private void UserSettingsView_Loaded(object sender, RoutedEventArgs e)
        {
            //if (DataContext == ((((Parent as TabItem).Parent as TabControl).Parent as Grid).Parent as MainView).DataContext || DataContext == null)
            
            
        }

        private void UserSettingsView_Unloaded(object sender, RoutedEventArgs e)
        {
        }

        private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
        {
            Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
            e.Handled = true;
        }
    }
}
